package cn.itsource.ymcc.client;

import cn.itsource.ymcc.result.JsonResult;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

@Component
public class CourseUserLearnClientFallbackfactory implements FallbackFactory<CourseUserLearnClient> {
    @Override
    public CourseUserLearnClient create(Throwable throwable) {
        return new CourseUserLearnClient() {
            @Override
            public JsonResult loadByUserIdAndCourseId(Long loginId, Long courseId) {
                throwable.printStackTrace();
                return JsonResult.error("课程服务 loadByUserIdAndCourseId 接口调用失败！" + throwable.getMessage());
            }
        };
    }
}
